<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Insert title here</title>
<link
	href="${pageContext.request.contextPath}/static/bootstrap4/css/bootstrap.min.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath}/static/plugins/bootstrap-table/bootstrap-table.min.css"
	rel="stylesheet">
</head>
<body>
	<div class="container-sm">
		<div class="well" style="width:600px;margin:0px auto;">
			<form action="#" method="post" name="loginFrm">
				<div class="form-group">
					<label>账号</label>
					<input type="text" class="form-control" name="loginId"/>
				</div>
				<div class="form-group">
					<label>密码</label>
					<input type="password" class="form-control" name="loginPwd"/>
				</div>
				<div class="form-group">
					<input type="button" id="btnSubmit" class="btn btn-info" value="登入"/>
				</div>
			</form>
		</div>
	</div>
	<a href="doupload.jsp">去上传文件</a>
</body>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/jQuery/jquery-3.1.0.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/popper/popper.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/bootstrap4/js/bootstrap.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

<script type="text/javascript">
	$(function(){
		$("#btnSubmit").on("click",function(){
			//用ajax提交表单
			$.ajax({
				url:'${pageContext.request.contextPath}/user/check',
				type:'post',
				dataType:'json',
				data:{loginId:$("input[name=loginId]").val(),loginPwd:$("input[name=loginPwd]").val()},
				success:function(dt){
					console.log(dt);
					var tonewloc = dt.result;
					if(dt.resultCode==200){
						window.location.href=tonewloc;
					}
				},
				error:function(dt){
					console.log(dt);
				}
			});
		});
	});
</script>




















</html>